home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: mxsld2.pd.infn.it!LORETI
- From: loreti@mxsld2.pd.infn.it (Maurizio Loreti)
- Subject: Re: calloc help needed
- X-Nntp-Posting-Host: mxsld2.pd.infn.it
- Message-ID: <Dn4nK7.I18@news.cern.ch>
- Sender: news@news.cern.ch (USENET News System)
- Reply-To: loreti@mxsld2.pd.infn.it
- Organization: I.N.F.N. Padova - CDF/CMS VAXcluster
- References: <1996Feb15.125431.7751@leeds.ac.uk>,<4fvmgbINNbp0@keats.ugrad.cs.ubc.ca>
- Date: Wed, 21 Feb 1996 13:16:53 GMT
-
- In article <4fvmgbINNbp0@keats.ugrad.cs.ubc.ca>, c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
- >In article <1996Feb15.125431.7751@leeds.ac.uk>,
- >A M Casey <csyamc@scs.leeds.ac.uk> wrote:
- > >I'm trying to allocate enough memory for an array of strings, defined as
- > >char * MyArray[20].
- > >the only manual entry I have for calloc says that it needs two values, the
- > >number of elements, and the size of each, but how do I actually use it?
- > >
- > >MyArray = calloc(20,50);
- >
- >This is gives you much more space than you need for the array. A character's
- >size is not 50!
- >
- > >doesnt work, as far as I can tell calloc returns an int.
- >
- >It is probably "implicitly defined" to return an int, because you lack a
- >declaration. Try including the "malloc.h" header file.
-
- You misspelled <stdlib.h> ...
- --
- Maurizio Loreti http://mvxpd5.pd.infn.it/wwwcdf/mlo.html
- Un. of Padova, Dept. of Physics - Padova, Italy loreti@padova.infn.it
-